import Vue from 'vue'
import VueRouter from 'vue-router'

// 如果导入的是一个文件夹,就会自动寻找下面的index.vue
import login from '@/views/login'
import layout from '@/views/layout'
import dashboard from '@/views/dashboard'
import article from '@/views/article'
Vue.use(VueRouter)

const routes = [
  { path: '/login', component: login },
  {
    path: '/',
    component: layout,
    redirect: '/dashboard',
    children: [
      { path: 'dashboard', component: dashboard },
      { path: 'article', component: article }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
